$(document).ready(function () {
	//设置当前页面选中样式
	setting_style_the_page();
	function setting_style_the_page() {
		var first_menu_item = $('#sidebar-nav').find('a[href="#accounts-menu-first-04"]');//获取一级菜单可点击的a标签 "投诉管理"
		var img_nav = first_menu_item.find('.define-nav');//获取导航图片
		var img_left = first_menu_item.find('.define-left');//获取转向图片
		var first_ul = $('#accounts-menu-first-04');//获取一级下拉菜单
		var first_ul_li_one = first_ul.children('li').eq(2);//获取  "患者管理"

		var second_menu_item = $('#sidebar-nav').find('a[href="#accounts-menu-second-04-02"]');//获取二级菜单可点击的a标签
		var second_img_left = second_menu_item.parent().find('.define-left');//获取导航图片
		var second_ul = $('#accounts-menu-second-04-02');//获取二级下拉菜单
		var second_ul_li_one = second_ul.children('li').eq(0);//获取  "投诉汇总"

		first_menu_item.addClass('define-active');//一级菜单添加左边横线
		img_nav.attr('src','/statics/images/sever_hospital_select.png');//切换导航图片
		img_left.addClass('define-rotate-active');//添加动画类
		first_ul.addClass('in');//展拉一级菜单
		first_ul_li_one.addClass('define-active');//li添加左边横线

		second_menu_item.parent().addClass('define-active');
		second_img_left.addClass('define-rotate-active');
		second_ul.addClass('in');//展开二级菜单
		second_ul_li_one.addClass('define-active');//"患者账号管理"  添加选中样式
	}

	//分页切换效果
	page_style_switch();
	function page_style_switch() {
		var page_ = $('.define-paging');
		var the_first_page = $('#the_first_page');//获取首页
		var prev_page = $('#prev_page');//获取上一页
		var next_page = $('#next_page');//获取下一页
		var the_last_page = $('#the_last_page');//获取尾页

		// 123456
		page_.delegate('.define-page','click',function () {
			page_.find('.define-page').removeClass('define-active');
			$(this).addClass('define-active');
		});

		// 上一页
		prev_page.on('click',function () {
			var active_page = page_.find('.define-active');
			if(active_page.text() > 1){
				page_.find('.define-page').removeClass('define-active');
				active_page.prev().addClass('define-active')
			}
		});

		// 下一页
		next_page.on('click',function () {
			var active_page = page_.find('.define-active');
			if(active_page.text() < 5){
				page_.find('.define-page').removeClass('define-active');
				active_page.next().addClass('define-active')
			}
		});

		// 首页
		the_first_page.on('click',function () {
			page_.find('.define-page').removeClass('define-active');
			page_.find('.define-page').eq(0).addClass('define-active');
		});

		// 尾页
		the_last_page.on('click',function () {
			page_.find('.define-page').removeClass('define-active');
			page_.find('.define-page').eq(4).addClass('define-active');
		});

	}

	//页面  table 超出滑动
	page_overflow_scroll();
	function page_overflow_scroll() {
		var define_content_result = $('#define_content_result');
		var thead_height = define_content_result.find('thead').height();
		var tr_height = define_content_result.find('tbody').find('tr').height() * 7;
		define_content_result.parent().css( 'height' , thead_height + tr_height );
	}

});